"""
7-3 统计素数并求和
本题要求统计给定整数M和N区间内素数的个数并对它们求和。
输入在一行中给出两个正整数M和N（1≤M≤N≤500）
"""


# "埃拉托斯特尼筛法"
def count_and_get_primes_sum(M, N):
    count = 0
    primes_sum = 0

    # 特判
    if M == 1 and N == 1:
        return 0, 0

    primes = [True] * (N + 1)
    primes[0] = primes[1] = False
    for i in range(2, int(N**0.5)+1):
        if primes[i]:
            for j in  range(i*i, N+1, i):
                primes[j] = False

    # 在[M,N]中筛选
    for k in range(M, N+1):
        if primes[k]:
            count += 1
            primes_sum += k
    return count, primes_sum


def resolution1():
    lines = input().split(" ")
    M = int(lines[0])
    N = int(lines[1])
    count, primes_sum = count_and_get_primes_sum(M, N)
    print(count, primes_sum)


if __name__ == '__main__':
    resolution1()